Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

Math plugin #137

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

Math plugin #137

wants to merge 3 commits into from

Conversation

Rayden
Copy link

@Rayden Rayden commented Nov 17, 2010

Security issue in eval() is fixed

@SirPepe
Copy link
Contributor

SirPepe commented Nov 25, 2010

Great, this works rather well. One final question: what's the reason for restricting the plugin to certain css properties?

@Rayden
Copy link
Author

Rayden commented Nov 26, 2010

I did that because those are all the known properties who can have a measurement value. Its easy to extend. If you know of more or need also html 5 properties inside there i can easely add them

@SirPepe
Copy link
Contributor

SirPepe commented Nov 26, 2010

I'm less concered about HTML5 oder CSS3, I'm thinking more about people who write their own plugins for Turbine and make up new properties. If there isn't some security problem or something I would like to see this restriction dropped... because if nothing can go wrong, why should we be restricting ourselves?

@Rayden
Copy link
Author

Rayden commented Nov 29, 2010

as far i know there will not be any problem if i take out the property list and let the script walk trough all properties. Hopeful this week i can find some time on the office or at home to modify the plugin.

@commi
Copy link
Contributor

commi commented Feb 21, 2011

it would be great if this could work for colors too. lessphp has some fancy color math, but don't have the skill to port that to turbine.

color are array in turbine, so the eval you use wont work.

i could imagine the following:

  1. detect a color-calculation with fancy regex (there are color-regexes in the Utility-Class, one could use them in a bigger regex)
  2. extract all colors from that string (again the regexes are there) to an array
  3. convert colors in that array to rgba-array (Utility::any2rgba)
  4. for each color-compontent (r, g, b, a) replace the color in the original string with that one component (a float)
  5. eval that string
  6. you get one result for each component, just put those together as an rgba(r,g,b,a) string
  7. let the colormodels-plugin take care of the old browsers

thats my stupid idea, if this sounds doable to you and no one else likes to implement it i might try it.

@anselmh
Copy link

anselmh commented May 27, 2011

What about sth. like line-height? Why shouldn't I be able to calculate, too? I wouldn't restrict this to predefined elements as it's more future-proof to allow it for all properties.

I would really like to see this in Turbine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants